<?php


namespace App\frontend\services\orders;


class OrderServices
{

    /**
     * 生成唯一单号
     *
     * @param $prefix //前缀一般为两个大写字母
     * @param string $field //字段不为 order_sn 时需要参数field
     * @param int $length //日期后随机数长度
     * @param bool $numeric //受否为纯数字
     * @return string
     */
    public static function createOrderSn($prefix, $field = 'order_sn', $length = 6, $numeric = true)
    {
        $orderSn = rand($prefix, $length, $numeric);
        return $orderSn;
    }

    /**
     * 订单列表
     *
     * @param $data //数组
     * @return array
     */
    public static function getList($data)
    {
        if ($data == false) {
            return '';
        }
        return $data;
    }

    /**
     * 待支付订单
     * @param $member_id //整型
     * @return int
     */
    public static  function getWaitPayTotal($member_id){
        $total = 0;
        if (empty($member_id)){
            return $total;
        }
        //获取用户数据
        $total = 2;
        return $total;
    }

    /**
     * 待发货订单统计
     * @param $member_id
     * @return int
     */
    public static  function getWaitSendTotal($member_id){
        $total = 0;
        if (empty($member_id)){
            return $total;
        }
        //获取用户数据
        $total = 15;
        return $total;
    }

    /**
     * 待收货订单统计
     * @param $member_id
     * @return int
     */
    public static  function getWaitReceiveTotal($member_id){
        $total = 0;
        if (empty($member_id)){
            return $total;
        }
        //获取用户数据
        $total = 12;
        return $total;
    }

    /**
     * 待评价订单统计
     * @param $member_id
     * @return int
     */
    public static  function getWaitCommentTotal($member_id){
        $total = 0;
        if (empty($member_id)){
            return $total;
        }
        //获取用户数据
        $total = 6;
        return $total;
    }

    /**
     * 售后订单统计
     * @param $member_id
     * @return int
     */
    public static  function getafterSalesTotal($member_id){
        $total = 0;
        if (empty($member_id)){
            return $total;
        }
        //获取用户数据
        $total = 0;
        return $total;
    }


}
